#include "Common.hpp"

int main()
{
    int wfd = open(Path, O_WRONLY);
    if(wfd < 0)
    {
        cerr << "write open failed, errno: " << errno << ", errstring: " << strerror(errno) << endl;
        return 1;
    }
    string inBuffer;
    while(true)
    {
        cout << "please input your message# ";
        getline(cin, inBuffer);
        if(inBuffer == "quit") break;
        ssize_t n = write(wfd, inBuffer.c_str(), inBuffer.size());
        if (n < 0)
        {
            cerr << "write failed, errno: " << errno << ", errstring: " << strerror(errno) << endl;
            break;
        }
    }
    close(wfd);
    return 0;
}
